package convert

import (
	"k9-panel/app/adapter/internal"
	"k9-panel/app/model"
)

func ProjectModel2ProjectRsp(project *model.Project) *internal.ProjectRsp {
	var rsp internal.ProjectRsp
	rsp.ID = project.ID
	rsp.Name = project.Name
	rsp.Description = project.Description
	if project.Environments != nil {

		for _, item := range project.Environments {
			env := &internal.EnvRsp{
				ID:          item.ID,
				Name:        item.Name,
				Description: item.Description,
			}
			rsp.Env = append(rsp.Env, env)
		}
	}
	return &rsp
}
func EnvModel2EnvRsp(model *model.Environment) *internal.EnvRsp {
	var rsp internal.EnvRsp
	rsp.ID = model.ID
	rsp.Name = model.Name
	rsp.Description = model.Description
	return &rsp
}
